"""
58. 最后一个单词的长度
"""
def solution(a,b):
    ai = int(a)
    bi = int(b)
    sumi = ai+bi
    suml = list(str(sumi))
    print(suml)
    for i in range(len(suml)-1, 0,-1):
        if int(suml[i]) >= 2:
            suml[i] = str(int(suml[i])-2)
            suml[i-1] = str(int(suml[i-1])+1)
    if int(suml[0]) >= 2:
        suml[0] = str(int(suml[0])-2)
        suml.insert(0,'1')
    return ''.join(suml)

class Solution:
    def mySqrt(self, x: int) -> int:
        # 为了照顾到 0 把左边界设置为 0
        left = 0
        # 为了照顾到 1 把右边界设置为 x // 2 + 1
        right = x // 2 + 1
        while left < right:
            # 注意：这里一定取右中位数，如果取左中位数，代码可能会进入死循环
            # mid = left + (right - left + 1) // 2
            mid = (left + right + 1) >> 1
            square = mid * mid

            if square > x:
                right = mid - 1
            else:
                left = mid
        # 因为一定存在，因此无需后处理
        return left


if __name__ == "__main__":
    print(range(3,-1,-1))
    testl = ['1','2']
    testl[1] = str(int(testl[1])-2)
    print(range(int(2147395599/2)+1))
    for i in range(int(2147395599/2)+1):
        pass
    #print(testl)
    #print(solution("1011","1011"))